﻿/*******************************************************************************
 * AAEngine
 * Copyright (c) 2010 Mike Jarosch
 *
 * Original source PushButton Engine:
 * Copyright (C) 2009 PushButton Labs, LLC
 * For more information see http://www.pushbuttonengine.com
 *
 * This file is licensed under the terms of the MIT license, which is included
 * in the "MIT License.txt" file at the root directory of this SDK.
 ******************************************************************************/

using Microsoft.Xna.Framework;
using AAEngine.Engine;
using AAEngine.Engine.Core;

namespace AAEngine.Rendering2D
{
    /// <summary>
    /// Object with extents and ability to be ray-casted.
    /// </summary>
    /// <remarks>
    /// This is the basic interface for objects that support 2D spatial queries.
    /// It is enough to do broad phase collision checks and ray casts.
    /// </remarks>
    public interface ISpatialObject2D
    {
        /// <summary>
        /// Axis aligned object bounds in world space.
        /// </summary>
        Box WorldExtents { get; }

        /// <summary>
        /// This object's collision flags
        /// </summary>
        ObjectType ObjectMask { get; }

        /// <summary>
        /// Perform a ray cast against this object.
        /// </summary>
        bool CastRay(Vector2 start, Vector2 end, ObjectType mask, ref RayHitInfo result);

        /// <summary>
        /// Return true if the specified point is occupied by this object, used for
        /// ObjectsUnderPoint.
        /// </summary>
        /// <param name="position">Location in worldspace to check.</param>
        /// <param name="mask"></param>
        /// <param name="scene">If we want to have the results line up with the view, we
        /// need access to the scene we're doing the check from.</param>
        /// <returns></returns>
        bool PointOccupied(Vector2 position, ObjectType mask, IScene2D scene);
    }
}
